.TH MOTION 1 2017-11-05 "Motion" "Motion Options and Config Files"
.SH NAME
motion \-   Detect motion using a video4linux device or network camera
.SH SYNOPSIS
.B motion [ \-hbnsm ] [ \-c config file path ] [ \-d level ] [ \-k level ] [ \-p process_id_file ][ \-l log_file ]
.SH DESCRIPTION
.I  Motion
uses a video4linux device or network camera to detect motion. If motion is detected both normal
and motion pictures can be taken. Motion can also take actions to notify you
if needed. Creation of automated snapshots is also possible.
.SH OPTIONS
.TP
.B \-c
Full path and filename of config file.
For example: \fI /home/kurt/motion.conf \fR
The default is \fI /usr/local/etc/motion\fR unless specified differently when building Motion.
Many RPMs and Debian packages will use \fI/etc\fR or \fI/etc/motion\fR as the default.
.TP
.B \-h
Show help screen.
.TP
.B \-b
Run in daemon mode.
.TP
.B \-n
Run in non-daemon mode.
.TP
.B \-s
Run in setup mode. Also forces non-daemon mode.
.TP
.B \-d
Run with message log level 1-9.
.TP
.B \-k
Run with message log type 1-9.
.TP
.B \-l
Full path and file name for the log file.
.TP
.B \-p
Full path and filename for process id file (pid file). E.g /var/run/motion.pid. Default is not defined. Pid file is only created when Motion is started in daemon mode.
.TP
.B \-m
Start in pause mode.
.TP
.SH "CONFIG FILE OPTIONS"
These are the options that can be used in the config file.
.I They are overridden by the commandline!
All number values are integer numbers (no decimals allowed).
Boolean options can be on or off (values "1", "yes" and "on" all means true and any other value means false).

.TP
.B daemon
.RS
.nf
Values: on/off
Default: off
Description:
.fi
.RS
When specified as ON, Motion goes into daemon (background process) mode and releases the terminal.
.RE
.RE

.TP
.B process_id_file
.RS
.nf
Values: User specified string
Default: Not defined
Description:
.fi
.RS
File to store the process ID, also called pid file.
.RE
.RE

.TP
.B setup_mode
.RS
.nf
Values: on/off
Default: off
Description:
.fi
.RS
Start in Setup-Mode, daemon disabled.
.RE
.RE

.TP
.B logfile
.RS
.nf
Values: User specified string
Default: Not Defined
Description:
.fi
.RS
File to save logs messages, if not defined stderr and syslog is used.
.RE
.RE

.TP
.B log_level
.RS
.nf
Values: 1 to 9 (EMG, ALR, CRT, ERR, WRN, NTC, INF, DBG, ALL)
Default: 6 / NTC
Description:
.fi
.RS
Specify the level of verbosity in the messages sent to the log.
.RE
.RE

.TP
.B log_type
.RS
.nf
Values: COR, STR, ENC, NET, DBL, EVT, TRK, VID, ALL
Default: ALL
Description:
.fi
.RS
Filter to log messages by type
.RE
.RE

.TP
.B camera_id
.RS
.nf
Values: Numeric identification number for the camera
Default: The order in which the camera is opened by Motion
Description:
.fi
.RS
Use this option to assign a number to each camera that is consistent every time that Motion is started.
By default Motion will assign a number based upon the sequence in which it reads the configuration and this
sequence may not be the same every time that Motion starts.
.RE
.RE

.TP
.B camera_name
.RS
.nf
Values: User specified string
Default: Not Defined
Description:
.fi
.RS
User specified string to describe the camera.
.RE
.RE

.TP
.B videodevice
.RS
.nf
Values: User specified string
Default: /dev/video0
Description:
.fi
.RS
String to specify the videodevice to be used for capturing.
The format is usually /dev/videoX where X varies depending upon the video devices connected to the computer.
For FreeBSD certain devices use the bktr subsystem and they will use /dev/bktr0.
.RE
.RE

.TP
.B v4l2_palette
.RS
.nf
Values: 0 to 17
.RS
V4L2_PIX_FMT_SN9C10X : 0  'S910'
V4L2_PIX_FMT_SBGGR16 : 1  'BYR2'
V4L2_PIX_FMT_SBGGR8  : 2  'BA81'
V4L2_PIX_FMT_SPCA561 : 3  'S561'
V4L2_PIX_FMT_SGBRG8  : 4  'GBRG'
V4L2_PIX_FMT_SGRBG8  : 5  'GRBG'
V4L2_PIX_FMT_PAC207  : 6  'P207'
V4L2_PIX_FMT_PJPG    : 7  'PJPG'
V4L2_PIX_FMT_MJPEG   : 8  'MJPEG'
V4L2_PIX_FMT_JPEG    : 9  'JPEG'
V4L2_PIX_FMT_RGB24   : 10 'RGB3'
V4L2_PIX_FMT_SPCA501 : 11 'S501'
V4L2_PIX_FMT_SPCA505 : 12 'S505'
V4L2_PIX_FMT_SPCA508 : 13 'S508'
V4L2_PIX_FMT_UYVY    : 14 'UYVY'
V4L2_PIX_FMT_YUYV    : 15 'YUYV'
V4L2_PIX_FMT_YUV422P : 16 '422P'
V4L2_PIX_FMT_YUV420  : 17 'YU12'
V4L2_PIX_FMT_Y10     : 18 'Y10'
V4L2_PIX_FMT_Y12     : 19 'Y12'
V4L2_PIX_FMT_GREY    : 20 'GREY'
V4L2_PIX_FMT_H264    : 21 'H264'
.RE
Default: 17
Description:
.fi
.RS
The v4l2_palette option allows users to choose the preferred palette to be use by motion to capture from the video device.
If the preferred palette is not available from the video device, Motion will attempt to use palettes that are supported.
.RE
.RE

.TP
.B tunerdevice
.RS
.nf
Values: User Specified String
Default: /dev/tuner0
Description:
.fi
.RS
Tuner device to be used for capturing images.
This is ONLY used for FreeBSD.
.RE
.RE

.TP
.B input
.RS
.nf
Values:
.RS
\-1 : USB Cameras
0 : video/TV cards or uvideo(4) on OpenBSD
1 : video/TV cards
.RE
Default: \-1
Description:
.fi
.RS
The video input to be used.
.RE
.RE

.TP
.B norm
.RS
.nf
Values:
.RS
0 (PAL)
1 (NTSC)
2 (SECAM)
3 (PAL NC no colour)
.RE
Default: 0 (PAL)
Description:
.fi
.RS
The video norm to use when capturing from TV tuner cards
.RE
.RE

.TP
.B frequency
.RS
.nf
Values: Dependent upon video device
Default: 0
Description:
.fi
.RS
The frequency to set the tuner in kHz when using a TV tuner card.
.RE
.RE

.TP
.B power_line_frequency
.RS
.nf
Values:
.RS
-1 : Do not modify device setting
0  : Power line frequency Disabled
1  : 50hz
2  : 60hz
3  : Auto
.RE
Default: -1
Description:
.fi
.RS
Override the power line frequency for the video device.
.RE
.RE

.TP
.B rotate
.RS
.nf
Values: 0, 90, 180, 270
Default: 0
Description:
.fi
.RS
Rotate image this number of degrees.
The rotation affects all saved images as well as movies.
.RE
.RE

.TP
.B flip_axis
.RS
.nf
Values: none, v, h
Default: none
Description:
.fi
.RS
Flip the images vertically or horizontally.
The flip affects all saved images as well as movies.
.RE
.RE

.TP
.B width
.RS
.nf
Values: Dependent upon video device
Default: 352
Description:
.fi
.RS
Image width in pixels for the video device.
.RE
.RE

.TP
.B height
.RS
.nf
Values: Dependent upon video device
Default: off
Description:
.fi
.RS
Image height in pixels for the video device
.RE
.RE

.TP
.B framerate
.RS
.nf
Values: 2 - 100
Default: 100
Description:
.fi
.RS
The maximum number of frames to capture in 1 second.
The default of 100 will normally be limited by the capabilities of the video device.
Typical video devices have a maximum rate of 30.
.RE
.RE

.TP
.B minimum_frame_time
.RS
.nf
Values: 0 to unlimited
Default: 0
Description:
.fi
.RS
The minimum time in seconds between capturing picture frames from the camera.
The default of 0 disables this option and relies upon the capture rate of the camera.
This option is used when you want to capture images at a rate lower than 2 per second.
.RE
.RE

.TP
.B netcam_url
.RS
.nf
Values: User specified string
Default: None
Description:
.fi
.RS
Full connection URL string to use to connect to a network camera.
The URL must provide a stream of images instead of only a static image.
The following prefixes are recognized

.RS
http://
ftp://
mjpg://
rtsp://
rtmp://
mjpeg://
file://
v4l2://
.RE

The connection string is camera specific.
It is usually the same as what other video playing applications would use to connect to the camera stream.
Motion currently only supports basic authentication for the cameras.
Digest is not currently supported.
Basic authentication can be specified in the URL or via the netcam_userpass option.
.RE
.RE

.TP
.B netcam_highres
.RS
.nf
Values: User specified string
Default: None
Description:
.fi
.RS
Full connection URL string to use to connect to a high resolution network camera.
The URL must provide a stream of images instead of only a static image.
The following prefixes are recognized

.RS
rtsp://
rtmp://
.RE

The connection string is camera specific.
It is usually the same as what other video playing applications would use to connect to the camera stream.
Motion currently only supports basic authentication for the cameras.
Digest is not currently supported.
Basic authentication can be specified in the URL or via the netcam_userpass option.
.RE
.RE

.TP
.B netcam_userpass
.RS
.nf
Values: User specified string
Default: Not Defined
Description:
.fi
.RS
The user id and password required to access the network camera string.
Only basic authentication is supported at this time.
Format is in user:password format when both a user name and password are required.
.RE
.RE

.TP
.B netcam_keepalive
.RS
.nf
Values:
.RS
.fi
off:   The historical implementation using HTTP/1.0, closing the socket after each http request.
.nf

.fi
force: Use HTTP/1.0 requests with keep alive header to reuse the same connection.
.nf

.fi
on:    Use HTTP/1.1 requests that support keep alive as default.
.nf
.RE
Default: off
Description:
.fi
.RS
This setting is to keep-alive (open) the network socket between requests.
When used, this option should improve performance on compatible net cameras.
This option is not applicable for the rtsp://, rtmp:// and mjpeg:// formats.
.RE
.RE

.TP
.B netcam_proxy
.RS
.nf
Values: User specified string
Default: Not defined
Description:
.fi
.RS
If required, the URL to use for a netcam proxy server.
For example, "http://myproxy".
If a port number other than 80 is needed, append to the specification.
For examplet, "http://myproxy:1234".
.RE
.RE

.TP
.B netcam_tolerant_check
.RS
.nf
Values: on/off
Default: off
Description:
.fi
.RS
Use a less strict jpeg validation for network cameras.
This can assist with cameras that have poor or buggy firmware.
.RE
.RE

.TP
.B rtsp_uses_tcp
.RS
.nf
Values: on/off
Default: on
Description:
.fi
.RS
When using a RTSP/RTMP connection for a network camera, use a TCP transport instead of UDP.
The UDP transport frequently results in "smeared" corrupt images.
.RE
.RE

.TP
.B mmalcam_name
.RS
.nf
Values: User specified string
Default: Not defined
Description:
.fi
.RS
Name of camera to use if you are using a camera accessed through OpenMax/MMAL.
This value is used to specify the use of the PI camera.
The typical value for the PI camera is vc.ril.camera
.RE
.RE

.TP
.B mmalcam_control_params
.RS
.nf
Values: User specified string
Default: Not defined
Description:
.fi
.RS
Camera configuration options to use for the OpenMax/MMAL camera.
See the raspivid/raspistill tool documentation for full list of options.
Typical value for the PI camera is -hf
.RE
.RE

.TP
.B auto_brightness
.RS
.nf
Values: on/off
Default: off
Description:
.fi
.RS
The auto_brightness feature uses the brightness option as its target value.
If brightness is zero auto_brightness will adjust to average brightness value 128.
only recommended for cameras without auto brightness.
.RE
.RE

.TP
.B brightness
.RS
.nf
Values: 0 to 255
Default: 0 (Disabled)
Description:
.fi
.RS
The initial brightness of a video device.
If auto_brightness is enabled, this value defines the average brightness level which Motion will try and adjust to.
.RE
.RE

.TP
.B contrast
.RS
.nf
Values: 0 to 255
Default: 0 (Disabled)
Description:
.fi
.RS
The contrast value to set for the video device.
.RE
.RE

.TP
.B saturation
.RS
.nf
Values: 0 to 255
Default: 0 (Disabled)
Description:
.fi
.RS
The saturation value to set for the video device.
.RE
.RE

.TP
.B hue
.RS
.nf
Values: 0 to 255
Default: 0 (Disabled)
Description:
.fi
.RS
The hue value to set for the video device.
.RE
.RE

.TP
.B roundrobin_frames
.RS
.nf
Values: 1 to unlimited
Default: 1
Description:
.fi
.RS
Number of frames to capture in each roundrobin step
.RE
.RE

.TP
.B roundrobin_skip
.RS
.nf
Values: 1 to unlimited
Default: 1
Description:
.fi
.RS
Number of frames to skip before each roundrobin step
.RE
.RE

.TP
.B switchfilter
.RS
.nf
Values: on/off
Default: off
Description:
.fi
.RS
Filter out noise generated by roundrobin
.RE
.RE

.TP
.B threshold
.RS
.nf
Values: 1 to unlimited
Default: 1500
Description:
.fi
.RS
Threshold for number of changed pixels in an image that triggers motion detection
.RE
.RE

.TP
.B threshold_tune
.RS
.nf
Values: on/off
Default: off
Description:
.fi
.RS
Automatically tune the threshold down if possible.
.RE
.RE

.TP
.B noise_level
.RS
.nf
Values: 1 to unlimited
Default: 32
Description:
.fi
.RS
Noise threshold for the motion detection.
.RE
.RE

.TP
.B noise_tune
.RS
.nf
Values: on/off
Default: on
Description:
.fi
.RS
Automatically tune the noise threshold
.RE
.RE

.TP
.B despeckle_filter
.RS
.nf
Values:
.RS
e/E : erode
d/D : dilate
l : label
.RE
Default: EedDl
Description:
.fi
.RS
Despeckle motion image using (e)rode or (d)ilate or (l)abel.
The recommended value is EedDl. Any combination (and number of) of E, e, d, and D is valid.
(l)abeling must only be used once and the 'l' must be the last letter.
Comment out to disable
.RE
.RE

.TP
.B area_detect
.RS
.nf
Values: 1 to 9
Default: Not Defined
Description:
.fi
.RS
When motion is detected in the predefined areas indicated below,
trigger the script indicated by the on_area_detected.
The trigger is only activated once during an event.
one or more areas can be specified with this option.
Note that this option is only used to trigger the indicated script.
It does not limit all motion detection events to only the area indicated.
.RS
Image Areas
.RE
.RS
123
.RE
.RS
456
.RE
.RS
789
.RE
.RE
.RE

.TP
.B mask_file
.RS
.nf
Values: User specified string
Default: Not defined
Description:
.fi
.RS
When particular area should be ignored for motion, it can be accomplished using a PGM mask file.
The PGM mask file is a specially constructed mask file that allows the user to indicate the areas
for which motion should be monitored.
This option specifies the full path and name for the mask file.
.RE
.RE

.TP
.B mask_privacy
.RS
.nf
Values: User specified string
Default: Not defined
Description:
.fi
.RS
The PGM mask file is a specially constructed mask file that allows the user to indicate the areas
to remove from all images.
This option specifies the full path and name for the privacy mask file.
.RE
.RE

.TP
.B smart_mask_speed
.RS
.nf
Values: 0 to 10
Default: 0 (off)
Description:
.fi
.RS
Speed of mask changes when creating a dynamic mask file.
.RE
.RE

.TP
.B lightswitch
.RS
.nf
Values: 0 to 100
Default: 0
Description:
.fi
.RS
Ignore sudden massive light intensity changes.
Value is a percentage of the picture area that changed intensity.
.RE
.RE

.TP
.B minimum_motion_frames
.RS
.nf
Values: 1 to unlimited
Default: 1
Description:
.fi
.RS
The minimum number of picture frames in a row that must contain motion before a event is triggered.
The default of 1 means that all motion is detected.
The recommended range is 1 to 5.
.RE
.RE

.TP
.B pre_capture
.RS
.nf
Values: 0 to unlimited
Default: 0
Description:
.fi
.RS
The number of pre-captured (buffered) pictures from before motion was detected that will be output upon motion detection.
The recommended range is 0 to 5.
It is not recommended to use large values since it will cause Motion to skip frames.
To smooth movies use larger values of post_capture instead.
.RE
.RE

.TP
.B post_capture
.RS
.nf
Values: 0 to unlimited
Default: 0
Description:
.fi
.RS
Number of frames to capture after motion is no longer detected.
.RE
.RE

.TP
.B event_gap
.RS
.nf
Values: -1 to unlimited
Default: 60
Description:
.fi
.RS
The number of seconds of no motion that triggers the end of an event.
An event is defined as a series of motion images taken within a short timeframe.
The recommended value is 60 seconds.  The value -1 is allowed and disables
events causing all Motion to be written to one single movie file and no pre_capture.
If set to 0, motion is running in gapless mode.
Movies don't have gaps anymore.
An event ends right after no more motion is detected and post_capture is over.
.RE
.RE

.TP
.B max_movie_time
.RS
.nf
Values: 0 to unlimited
Default: 0
Description:
.fi
.RS
Maximum length in seconds of a movie.
When value is exceeded a new movie file is created.
The value of 0 means that there is no limit.
.RE
.RE

.TP
.B emulate_motion
.RS
.nf
Values: on/off
Default: off
Description:
.fi
.RS
Always save images even if there was no motion.
.RE
.RE

.TP
.B output_pictures
.RS
.nf
Values: on, off, first, best, center
Default: on
Description:
.fi
.RS
Output pictures when motion is detected.
When set to 'first', only the first picture of an event is saved.
Picture with most motion of an event is saved when set to 'best'.
Picture with motion nearest center of picture is saved when set to 'center'.
Can be used as preview shot for the corresponding movie.
.RE
.RE

.TP
.B output_debug_pictures
.RS
.nf
Values: on/off
Default: off
Description:
.fi
.RS
Output pictures with only the pixels moving object (ghost images)
.RE
.RE

.TP
.B quality
.RS
.nf
Values: 1 to 100
Default: 75
Description:
.fi
.RS
The quality (in percent) to be used by the jpeg and webp compression
.RE
.RE

.TP
.B picture_type
.RS
.nf
Values: jpeg/ppm/webp
Default: jpeg
Description:
.fi
.RS
The file type of output images
.RE
.RE

.TP
.B ffmpeg_output_movies
.RS
.nf
Values: on/off
Default: off
Description:
.fi
.RS
Use ffmpeg to encode movies of the motion.
.RE
.RE

.TP
.B ffmpeg_output_debug_movies
.RS
.nf
Values: on/off
Default: off
Description:
.fi
.RS
Use ffmpeg to encode movies with only the pixels moving object (ghost images)
.RE
.RE

.TP
.B ffmpeg_bps
.RS
.nf
Values: 0 to unlimited
Default: 400000
Description:
.fi
.RS
Bitrate to be used by the ffmpeg encoder.
This option is ignored if ffmpeg_variable_bitrate is not 0.
.RE
.RE

.TP
.B ffmpeg_variable_bitrate
.RS
.nf
Values: 0 to 100
Default: 0
Description:
.fi
.RS
Enable and define the variable bitrate for the ffmpeg encoder.
ffmpeg_bps is ignored if variable bitrate is enabled.
When specified as 0, use the fixed bitrate defined by ffmpeg_bps.
When defined as 1 - 100 varies the quality of the movie.
A value of 1 is worst quality versus a value of 100 is best quality.
.RE
.RE

.TP
.B ffmpeg_video_codec
.RS
.nf
Values:
.RS
Motion videos:
.RS
mpeg4 - Creates .avi file
msmpeg4 - Creates .avi file
swf - Flash film with extension .swf
flv - Flash video with extension .flv
ffv1 - FF video codec 1 for Lossless Encoding
mov - QuickTime
mp4 - MPEG-4 Part 14 H264 encoding
mkv - Matroska H264 encoding
hevc - H.265 / HEVC (High Efficiency Video Coding)
.RE
.RE
Default: mpeg4
Description:
.fi
.RS
For regular motion videos, the container/codec must be available in the ffmpeg installed on the computer.
.RE
.RE

.TP
.B ffmpeg_duplicate_frames
.RS
.nf
Values: on/off
Default: off
Description:
.fi
.RS
When creating videos, should frames be duplicated in order to keep up with the requested frames per second
.RE
.RE

.TP
.B timelapse_fps
.RS
.nf
Values: 0 to unlimited
Default: 30
Description:
.fi
.RS
Frames per second used for playback of the timelapse video.
.RE
.RE

.TP
.B timelapse_interval
.RS
.nf
Values: 0 to unlimited
Default: 0
Description:
.fi
.RS
Number of seconds between frame captures for a timelapse movie.
Specify 0 to disable the timelapse.
.RE
.RE

.TP
.B timelapse_mode
.RS
.nf
Values:
.RS
hourly
.br
daily
.br
weekly-sunday
.br
weekly-monday
.br
monthly
.br
manual
.RE
Default: daily
Description:
.fi
.RS
File rollover mode for the timelapse video.
.RE
.RE

.TP
.B timelapse_codec
.RS
.nf
Values:
.RS
mpg - Creates mpg file with mpeg-2 encoding.
mpeg4 - Creates avi file with the default encoding.
.RE
Default: mpg
Description:
.fi
.RS
For mpg timelapse videos, if motion is shutdown and restarted, new pics will be appended
to any previously created file with name indicated for timelapse.
For mpeg4 timelapse videos, if motion is shutdown and restarted, new pics will create a
new file with the name indicated for timelapse.
.RE
.RE

.TP
.B use_extpipe
.RS
.nf
Values: on/off
Default: off
Description:
.fi
.RS
Use the external pipe in order to encode videos.
This is a replacement option for the FFMPEG builtin encoder for ffmpeg_output_movies only.
The options movie_filename and timelapse_filename are also used from the ffmpeg feature
.RE
.RE

.TP
.B extpipe
.RS
.nf
Values: User specified string
Default: Not defined
Description:
.fi
.RS
Command line string to receive and process a pipe of images to encode.
Generally, use '-' for STDIN
.RE
.RE

.TP
.B snapshot_interval
.RS
.nf
Values: 0 to unlimited
Default: 0
Description:
.fi
.RS
When specified as 0, the snapshot feature is disabled.
When a value is specified, the value indicates the number of seconds between snapshots.
.RE
.RE

.TP
.B locate_motion_mode
.RS
.nf
Values: on/off/preview
Default: off
Description:
.fi
.RS
When specified as 'on', locate and draw a box around the moving object.
When set 'preview', only draw a box in preview_shot pictures.
.RE
.RE

.TP
.B locate_motion_style
.RS
.nf
Values:
.RS
.fi
box : Draw traditional box around the part of the image generating the motion
.nf

.fi
redbox : Draw a red box around the part of the image generating the motion
.nf

.fi
cross : Draw a cross on the part of the image generating the motion
.nf

.fi
redcross : Draw a red cross on the part of the image generating the motion
.nf
.RE
Default: box
Description:
.fi
.RS
When locate_motion_mode is enable, this option specifies how the motion will be indicated on the image.
.RE
.RE

.TP
.B text_right
.RS
.nf
Values: User specified string
Default: %Y-%m-%d\n%T-%q
Description:
.fi
.RS
Text to place in lower right corner of image.  Format specifiers follow C function strftime(3)
.RE
.RE

.TP
.B text_left
.RS
.nf
Values: User specified string
Default: CAMERA %t
Description:
.fi
.RS
Text to place in lower left corner of image.  Format specifiers follow C function strftime(3)
.RE
.RE

.TP
.B text_changes
.RS
.nf
Values: on/off
Default: off
Description:
.fi
.RS
When specified, draw the number of changed pixed on the images.
This option will normally be set to off except when you setup and adjust the motion settings.
The text is placed in upper right corner of the image.
.RE
.RE

.TP
.B text_event
.RS
.nf
Values: User specified string
Default: %Y%m%d%H%M%S
Description:
.fi
.RS
Define the value of the special event conversion specifier %C.
The user can use any conversion specifier in this option except %C.
Date and time values are from the timestamp of the first image in the current event.
The %C can be used filenames and text_left/right for creating
a unique identifier for each event.
.RE
.RE

.TP
.B text_scale
.RS
.nf
Values: 1 to 10
Default: 1
Description:
.fi
.RS
The scale at which to draw text over the image.
.RE
.RE

.TP
.B exif_text
.RS
.nf
Values: User specified string
Default: Not defined
Description:
.fi
.RS
Text to include in a JPEG EXIF comment
.RE
.RE

.TP
.B target_dir
.RS
.nf
Values: User specified string
Default: Not defined
Description:
.fi
.RS
Target base directory for pictures and films.
It is recommended to use an absolute path.
If this option is not defined, the current working directory is used.
This option accepts the conversion specifiers included at the end of this manual.
.RE
.RE

.TP
.B snapshot_filename
.RS
.nf
Values: User specified string
Default: %v-%Y%m%d%H%M%S-snapshot
Description:
.fi
.RS
The file path for snapshots relative to target_dir.
The file extension .jpg, .ppm or .webp is automatically added so do not include this.
A symbolic link called lastsnap.jpg created in the target_dir will always
point to the latest snapshot, unless snapshot_filename is exactly 'lastsnap'
This option accepts the conversion specifiers included at the end of this manual.
.RE
.RE

.TP
.B picture_filename
.RS
.nf
Values: User specified string
Default: %v-%Y%m%d%H%M%S-%q
Description:
.fi
.RS
The file path for motion triggered images (jpeg, ppm or webp) relative to target_dir.
The file extension .jpg, .ppm or .webp is automatically added so do not include this.
Set to 'preview' together with best-preview feature enables special naming
convention for preview shots.
This option accepts the conversion specifiers included at the end of this manual.
.RE
.RE

.TP
.B movie_filename
.RS
.nf
Values: User specified string
Default: %v-%Y%m%d%H%M%S
Description:
.fi
.RS
File path for motion triggered ffmpeg films (movies) relative to target_dir.
The extensions(.swf, .avi, etc) are automatically added so do not include them
This option accepts the conversion specifiers included at the end of this manual.
.RE
.RE

.TP
.B timelapse_filename
.RS
.nf
Values: User specified string
Default: %Y%m%d-timelapse
Description:
.fi
.RS
File path for timelapse movies relative to target_dir.
The file extensions(.mpg .avi) are automatically added so do not include them
This option accepts the conversion specifiers included at the end of this manual.
.RE
.RE

.TP
.B ipv6_enabled
.RS
.nf
Values: on/off
Default: off
Description:
.fi
.RS
Listen to IPv6 localhost instead of IPv4
.RE
.RE

.TP
.B stream_port
.RS
.nf
Values: 0 to port number limit
Default: 0
Description:
.fi
.RS
This option is the port number that the mini-http server listens on for streams of the pictures.
.RE
.RE

.TP
.B substream_port
.RS
.nf
Values: 0 to port number limit
Default: 0
Description:
.fi
.RS
This option is the substream port number that the mini-http server listens on for streams of the pictures.
.RE
.RE

.TP
.B stream_quality
.RS
.nf
Values: 1 to 100
Default: 50
Description:
.fi
.RS
The quality in percent for the jpg images streamed.
.RE
.RE

.TP
.B stream_motion
.RS
.nf
Values: on/off
Default: off
Description:
.fi
.RS
Output frames at 1 fps when no motion is detected and increase to the rate given by stream_maxrate when motion is detected
.RE
.RE

.TP
.B stream_maxrate
.RS
.nf
Values: 1 to unlimited
Default: 1
Description:
.fi
.RS
Maximum frame rate to send to stream
.RE
.RE

.TP
.B stream_localhost
.RS
.nf
Values: on/off
Default: off
Description:
.fi
.RS
Restrict stream connections to localhost only
.RE
.RE

.TP
.B stream_limit
.RS
.nf
Values: 0 to unlimited
Default: 0
Description:
.fi
.RS
Limits the number of images per connection.
The default value of 0 means unlimited.
The number can be defined by multiplying actual stream rate by the desired number of seconds.
The actual stream rate is the smallest of the framerate and stream_maxrate.
.RE
.RE

.TP
.B stream_auth_method
.RS
.nf
Values:
.RS
0 = disabled
1 = Basic authentication
2 = MD5 digest (the safer authentication)
.RE
Default: 0
Description:
.fi
.RS
The authentication method to use for viewing the stream.
.RE
.RE

.TP
.B stream_cors_header
.RS
.nf
Values: User specified string
Default: Not defined
Description:
.fi
.RS
The Access-Control-Allow-Origin header value to be sent with the stream.
If unspecified, no Access-Control-Allow-Origin header is sent.
The header allows browsers to access the stream via cross-origin resource sharing (CORS).
For example, * allows access from browser client code served from any domain.
.RE
.RE

.TP
.B stream_authentication
.RS
.nf
Values: User specified string
Default: Not defined
Description:
.fi
.RS
The username and password to use for authentication of the stream.
The format is Username:Password
.RE
.RE

.TP
.B stream_preview_scale
.RS
.nf
Values: 1 to 100
Default: 25
Description:
.fi
.RS
This defines what percentage the stream image should be scaled to for the preview page
.RE
.RE

.TP
.B stream_preview_newline
.RS
.nf
Values: yes/no
Default: no
Description:
.fi
.RS
When the image is put on the preview page, should the image start on a new line.
This option allows the user to specify whether the preview images should be side by side
or stacked on the page.
.RE
.RE

.TP
.B webcontrol_port
.RS
.nf
Values: 0 to maximum port number
Default: 0
Description:
.fi
.RS
Port number for the web control / preview page.
.RE
.RE

.TP
.B webcontrol_localhost
.RS
.nf
Values: on/off
Default: off
Description:
.fi
.RS
Restrict control connections to localhost only
.RE
.RE

.TP
.B webcontrol_interface
.RS
.nf
Values: 0-1
Default: 0
Description:
.fi
.RS
Specified the web control interface type.  0=css, 1=text
.RE
.RE

.TP
.B webcontrol_authentication
.RS
.nf
Values:
.RS
The username and password to use for authentication of the webcontrol.
The format is Username:Password
.RE
.RE

.TP
.B webcontrol_parms
.RS
.nf
Values:
.RS
0 = No parameters available to change on web control
1 = Limited list of parameters available to change
2 = Advanced list of parameters (usually requires restart to become effective)
3 = Restricted list of parameters (User IDs, passwords, commands to execute, etc)
.RE
Default: 0
Description:
.fi
.RS
The type of parameters that are able to be modified via the web interface.  This parameter can never be modified
via the web interface and must be specified directly in the configuration file.
.RE
.RE

.TP
.B track_type
.RS
.nf
Values:
.RS
0 = none
1 = stepper
2 = iomojo
3 = pwc
4 = generic
5 = uvcvideo
6 = servo
.RE
Default: 0
Description:
.fi
.RS
This option specifies the type of tracker.
The generic type enables the definition of motion center and motion size to
be used with the conversion specifiers for options like on_motion_detected
.RE
.RE

.TP
.B track_auto
.RS
.nf
Values: on/off
Default: off
Description:
.fi
.RS
Enables/disables the automatic tracking.
.RE
.RE

.TP
.B track_port
.RS
.nf
Values: User specified string
Default: Not defined
Description:
.fi
.RS
The serial port of the motor.  For example /dev/ttyS0
.RE
.RE

.TP
.B Tracking options
.RS
.nf
track_motorx, track_motorx_reverse, track_motory, track_motory_reverse
track_maxx, track_minx, track_maxy, track_miny, track_homex, track_homey
track_iomojo_id, track_step_angle_x, track_step_angle_y, track_move_wait
track_speed, track_stepsize

.fi
.RE
.RS
.nf
Values: device dependent
Default: 0
Description:
.fi
.RS
These options specify the parameters for cameras with tracking capabilities.
.RE
.RE

.TP
.B track_generic_move
.RS
.nf
Values: User specified string
Default: Not defined
Description:
.fi
.RS
Full path and file name for the script to execute to move a camera in generic tracking mode.
.RE
.RE

.TP
.B quiet
.RS
.nf
Values: on/off
Default: on
Description:
.fi
.RS
Do not sound beeps when detecting motion
.RE
.RE

.TP
.B Script Options
.RS
.nf
on_event_start, on_event_end, on_picture_save
on_motion_detected, on_area_detected, on_movie_start
on_movie_end, on_camera_lost, on_camera_found

.fi
.RE
.RS
.nf
Values: User defined string
Default: Not defined
Description:
.fi
.RS
Specify the full path and file name for the script to execute when the indicated event occurs.
When a file name is required for the script, append a %f to the script string.
.RE
.RE

.TP
.B sql_log_picture
.RS
.nf
Values: on/off
Default: on
Description:
.fi
.RS
Log to the database when creating motion triggered picture file
.RE
.RE

.TP
.B sql_log_snapshot
.RS
.nf
Values: on/off
Default: on
Description:
.fi
.RS
Log to the database when creating a snapshot image file
.RE
.RE

.TP
.B sql_log_movie
.RS
.nf
Values: on/off
Default: off
Description:
.fi
.RS
Log to the database when creating motion triggered movie file
.RE
.RE

.TP
.B sql_log_timelapse
.RS
.nf
Values: on/off
Default: off
Description:
.fi
.RS
Log to the database when creating timelapse movies file
.RE
.RE

.TP
.B sql_query
.RS
.nf
Values: User defined string
Default: Not defined
Description:
.fi
.RS
SQL statement to execute when a event occurs.
Use same conversion specifiers as for text features
Additional special conversion specifiers are
.RS
%n = the number representing the file_type
%f = filename with full path
.RE
Sample table set up (not sql_query):
.RS
Mysql:  CREATE TABLE security (camera int, filename char(80) not null, frame int, file_type int, time_stamp timestamp(14), event_time_stamp timestamp(14));
.RE
.RS
Postgresql: CREATE TABLE security (camera int, filename char(80) not null, frame int, file_type int, time_stamp timestamp without time zone, event_time_stamp timestamp without time zone);
.RE
Sample sql_query
.RS
insert into security(camera, filename, frame, file_type, time_stamp, text_event) values('%t', '%f', '%q', '%n', '%Y-%m-%d %T', '%C')
.RE
.RE
.RE

.TP
.B sql_query_start
.RS
.nf
Values: User defined string
Default: Not defined
Description:
.fi
.RS
SQL statement to execute at the start of a event.
For mysql databases a unique id is returned in the dbeventid conversion specifier but for
other databases, the dbeventid conversion specifier is assigned to zero.
.RE
.RE
.RE

.TP
.B database_type
.RS
.nf
Values: mysql, postgresql, sqlite3
Default: Not defined
Description:
.fi
.RS
The type of database being used.
.RE
.RE

.TP
.B database_dbname
.RS
.nf
Values: User defined string
Default: Not defined
Description:
.fi
.RS
The name of the database being used (dbname).  For Sqlite3, the full path to the database.
.RE
.RE

.TP
.B database_host
.RS
.nf
Values: User defined string
Default: Not Defined
Description:
.fi
.RS
The name of the host on which the database is running.
.RE
.RE

.TP
.B database_user
.RS
.nf
Values: User defined string
Default: Not Defined
Description:
.fi
.RS
The username to access the database
.RE
.RE

.TP
.B database_password
.RS
.nf
Values: User defined string
Default: Not Defined
Description:
.fi
.RS
The database password for the user to access the database.
.RE
.RE

.TP
.B database_port
.RS
.nf
Values: 0 to maximum port number
Default: Not defined
Description:
.fi
.RS
The port to use in order to access the database.
Default ports: mysql 3306 , postgresql 5432
.RE
.RE

.TP
.B database_busy_timeout
.RS
.nf
Values: 0 to unlimited
Default: 0
Description:
.fi
.RS
Database wait time in milliseconds for locked database to be unlocked before returning database locked error
.RE
.RE

.TP
.B video_pipe
.RS
.nf
Values: User specified string
Default: Not Defined
Description:
.fi
.RS
Output images to a video4linux loopback device.
.RE
.RE

.TP
.B motion_video_pipe
.RS
.nf
Values: User specified string
Default: Not Defined
Description:
.fi
.RS
Output motion images to a video4linux loopback device.
.RE
.RE

.TP
.B camera_dir
.RS
.nf
Values: User specified string
Default: Not Defined
Description:
.fi
.RS
This option specifies the optional subdirectory that contains the camera config files.
.RE
.RE

.TP
.B camera
.RS
.nf
Values: User specified string
Default: Not Defined
Description:
.fi
.RS
This option specifies the full path and file name to individual camera files.
This option can be listed multiple times.
Each camera file should contain the options that are unique to that camera/video device.
Common options are obtained from the motion.conf file and values are overwritten from each
camera file.  While the motion.conf includes four sample camera files, the actual
limit of cameras is only dependent upon the machine capabilities.
Remember: If you have more than one camera you must have one
camera file for each one. For example, 2 cameras would require 3 files:
The motion.conf file AND camera1.conf and camera2.conf.
only put the options that are unique to each camera in the
camera config files.
.RE
.RE






.SH SIGNALS
Motion responds to the following signals:
.TP
.B SIGHUP
The config file will be reread.
.TP
.B SIGTERM
If needed motion will create an movie file of the last event and exit
.TP
.B SIGUSR1
Motion will create an movie file of the current event.
.SH NOTES
.TP
.B Snapshot
A snapshot is a picture taken at regular intervals independently of any movement in the picture.
.TP
.B Motion image
A "motion" image/movie shows the pixels that have actually changed during the last frames. These pictures are not very useful for normal presentation to the public but they are quite useful for testing and tuning and making mask files as you can see exactly where motion sees something moving. Motion is shown in greytones. If labelling is enabled the largest area is marked as blue. Smart mask is shown in read.
.TP
.B Normal image
A "normal" image is the real image taken by the camera with text overlayed.
.TP
.B Cameras and config files
If Motion was invoked with command line option \-c pathname Motion will expect the config file to be as specified. When you specify the config file on the command line with \-c you can call it anything.
.br
If you do not specify \-c or the filename you give Motion does not exist, Motion will search for the configuration file called 'motion.conf' in the following order:
.br
1. Current directory from where motion was invoked
.br
2. Then in a directory called '.motion' in the current users home directory (shell environment variable $HOME). E.g. /home/goofy/.motion/motion.conf
.br
3. The motion/ subdirectory inside the directory defined by the \-\-sysconfdir=DIR when running .configure during installation of Motion (If this option was not defined the default is /usr/local/etc/)
.br
If you have write access to /usr/local/etc/motion then the editor recommends having only one motion.conf file in the default /usr/local/etc/motion directory.
.br
Motion has a configuration file in the distribution package called motion-dist.conf. When you run 'make install' this files gets copied to the /usr/local/etc/motion directory.
.br
The configuration file needs to be renamed from motion-dist.conf to motion.conf. The original file is called motion-dist.conf so that your perfectly working motion.conf file does not accidentally get overwritten when you re-install or upgrade to a newer version of Motion.
.br
If you have more than one camera you should not try and invoke Motion more times. Motion is made to work with more than one camera in a very elegant way and the way to do it is to create a number of camera config files. Motion will then create an extra thread of itself for each camera. If you only have one camera you only need the motion.conf file. The minute you have two or more cameras you must have one camera config file per camera besides the motion.conf file.
.br
So if you have for example two cameras you need motion.conf and two camera config files. Total of 3 config files.
.br
An option that is common to all cameras can be placed in motion.conf. (You can also put all parameters in the camera files but that makes a lot of editing when you change a common thing).
.br
An option that is unique to a camera must be defined in each camera file.
.br
The first camera is defined in the first camera file called from motion.conf. The 2nd camera is defined in the 2nd camera file called from motion.conf etc.
.br
Any option defined in motion.conf will be used for all cameras except for the cameras in which the same option is defined in a camera config file.
.br
Motion reads its configuration parameters in the following sequence. If the same parameter exists more than one place the last one read wins.
.br
1. Motion reads the configuration file motion.conf from the beginning of the file going down line by line.
.br
2. If the option "camera" is defined in motion.conf, the camera configuration file(s) is/(are) read.
.br
3. Motion continues reading the rest of the motion.conf file. Any options from here will overrule the same option previously defines in a camera config file.
.br
4. Motion reads the command line option again overruling any previously defined options.
.br
So always call the camera config files in the end of the motion.conf file. If you define options in motion.conf AFTER the camera file calls, the same options in the camera files will never be used. So always put the camera file call at the end of motion.conf.
.br
If motion is built without specific features such as ffmpeg, mysql etc it will ignore the options that belongs to these features. You do not have to remove them or comment them out.
.br
If you run the http control command http://host:port/0/config/writeyes, motion will overwrite motion.conf and all the camera.conf files by autogenerated config files neatly formatted and only with the features included that Motion was built with. If you later re-build Motion with more features or upgrade to a new version, you can use your old config files, run the motion.conf.write command, and you will have new config files with the new options included all set to their default values. This makes upgrading very easy to do.
.TP
.B Conversion Specifiers for Advanced Filename and Text Features
The table below shows all the supported Conversion Specifiers you can use in the options text_left, text_right, snapshot_filename, jpeg_filename, ffmpeg_filename, timelapse_filename, on_event_start, on_event_end, on_picture_save, on_movie_start, on_movie_end, and on_motion_detected.
.br
In text_left and text_right you can additionally use '\\n' for new line.

.TP
.B %a
The abbreviated weekday name according to the current locale.
.TP
.B %A
The full weekday name according to the current locale.
.TP
.B %b
The abbreviated month name according to the current locale.
.TP
.B %B
The full month name according to the current locale.
.TP
.B %c
The preferred date and time representation for the current locale.
.TP
.B %C
Text defined by the text_event feature
.TP
.B %d
The day of the month as a decimal number (range 01 to 31).
.TP
.B %D
Number of pixels detected as Motion. If labelling is enabled the number is the number of pixels in the largest labelled motion area.
.TP
.B %E
Modifier: use alternative format, see below.
.TP
.B %f
File name - used in the on_picture_save, on_movie_start, on_movie_end, and sql_query features.
.TP
.B %F
Equivalent to %Y-%m-%d (the ISO 8601 date format).
.TP
.B %H
The hour as a decimal number using a 24-hour clock (range 00 to 23).
.TP
.B %i
Width of the rectangle containing the motion pixels (the rectangle that is shown on the image when locate is on).
.TP
.B %I
The hour as a decimal number using a 12-hour clock (range 01 to 12).
.TP
.B %j
The day of the year as a decimal number (range 001 to 366).
.TP
.B %J
Height of the rectangle containing the motion pixels (the rectangle that is shown on the image when locate is on).
.TP
.B %k
The hour (24-hour clock) as a decimal number (range 0 to 23); single digits are preceded by a blank. (See also %H.)
.TP
.B %K
X coordinate in pixels of the center point of motion. Origin is upper left corner.
.TP
.B %l
The hour (12-hour clock) as a decimal number (range 1 to 12); single digits are preceded by a blank. (See also %I.)
.TP
.B %L
Y coordinate in pixels of the center point of motion. Origin is upper left corner and number is positive moving downwards (I may change this soon).
.TP
.B %m
The month as a decimal number (range 01 to 12).
.TP
.B %M
The minute as a decimal number (range 00 to 59).
.TP
.B %n
Filetype as used in the on_picture_save, on_movie_start, on_movie_end, and sql_query features.
.TP
.B %N
Noise level.
.TP
.B %o
Threshold. The number of detected pixels required to trigger motion. When threshold_tune is 'on' this can be used to show the current tuned value of threshold.
.TP
.B %p
Either 'AM' or 'PM' according to the given time value, or the corresponding strings for the current locale. Noon is treated as `pm' and midnight as `am'.
.TP
.B %P
Like %p but in lowercase: `am' or `pm' or a corresponding string for the current locale.
.TP
.B %q
Picture frame number within current second. For jpeg filenames this should always be included in the filename if you save more then 1 picture per second to ensure unique filenames. It is not needed in filenames for mpegs.
.TP
.B %Q
Number of detected labels found by the despeckle feature
.TP
.B %r
The time in a.m. or p.m. notation.
.TP
.B %R
The time in 24-hour notation (%H:%M).
.TP
.B %s
The number of seconds since the Epoch, i.e., since 1970-01-01 00:00:00 UTC.
.TP
.B %S
The second as a decimal number (range 00 to 61).
.TP
.B %t
Camera ID number
.TP
.B %T
The time in 24-hour notation (%H:%M:%S).
.TP
.B %u
The day of the week as a decimal, range 1 to 7, Monday being 1. See also %w.
.TP
.B %U
The week number of the current year as a decimal number, range 00 to 53, starting with the first Sunday as the first day of week 01. See also %V and %W.
.TP
.B %v
Event number. An event is a series of motion detections happening with less than 'gap' seconds between them.
.TP
.B %V
The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week. See also %U and %W.
.TP
.B %w
The day of the week as a decimal, range 0 to 6, Sunday being 0. See also %u.
.TP
.B %W
The week number of the current year as a decimal number, range 00 to 53, starting with the first Monday as the first day of week 01.
.TP
.B %x
The preferred date representation for the current locale without the time.
.TP
.B %X
The preferred time representation for the current locale without the date.
.TP
.B %y
The year as a decimal number without a century (range 00 to 99).
.TP
.B %Y
The year as a decimal number including the century.
.TP
.B %z
The time-zone as hour offset from GMT.
.TP
.B %Z
The time zone or name or abbreviation.
.TP
.B %$
The camera name.
.TP
.B %{host}
The computer host name
.TP
.B %{fps}
The frame per seconds.
.TP
.B %{dbeventid}
The id number returned from mysql_insert_id.
.TP
.B %{ver}
The version number of Motion.



.TP
.B More information
Motion homepage: https://motion-project.github.io/

Motion Guide (user and installation guide):
.br /usr/share/doc/motion/motion_guide.html
.SH AUTHORS
Jeroen Vreeken (pe1rxq@amsat.org),
Folkert van Heusden,
Kenneth Lavrsen (kenneth@lavrsen.dk),
Juan Angulo Moreno <juan@apuntale.com>,
the motion-project team,
and many others
